﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace TeachingAffairsManagementSystem
{
    public partial class Logout : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            // 如果 cookie 存在 使过期
            HttpCookie loginDataCookie = Request.Cookies["login_data"];
            if (loginDataCookie != null)
            {
                loginDataCookie.Expires = DateTime.Now.AddDays(-1);
                Response.AppendCookie(loginDataCookie);
            }

            Session.Clear();
            Session["isLoggedIn"] = false;
            Response.Redirect("~/Home.aspx?i=logout");
        }
    }
}